<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <!-- No-op until loaded dynamically (could make configurable) -->
  <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
  <!-- STYLESHEETS (others loaded dynamically) -->
  <style id="styleoverrides" media="screen"></style>
  <link href="./svgedit.css" rel="stylesheet" media="all">
  </link>
  <!-- Lacking browser support -->
  <script type="module" src="./browser-not-supported.js"></script>
  <script type="module" src="./serveconfig.js"></script>
  <script type="module" src="./flexble.js"></script>
  <!-- <script type="module" src="./vue.js"></script>
  <script type="module" src="./index.js"></script>
  <link href="./index.css" rel="stylesheet" media="all"> -->
  <title>图元工具</title>
</head>
<!-- ip改动 -->
<!-- ui改动-->
<body style="margin:0">
  <div id="container" style="width:100%;height:100vh"></div>
</body>
 <!-- If you do not wish to add extensions by URL, you can add calls
      within the following file to svgEditor.setConfig -->
      <script type="module">
        window.urlType = 'ElementEditing';
        import Editor from './Editor.js'
/* for available options see the file `docs/tutorials/ConfigOptions.md */

const svgEditor = new Editor(document.getElementById('container'))
svgEditor.init(); 
  var leftwidth = (document.body.clientWidth/1366)*80;
  var rightwidth =  (document.body.clientWidth/1366)*200;
  var bottomHeight =  (document.body.clientWidth/1366)*150;
  var width = Math.round((window.innerWidth-leftwidth-rightwidth-15)/20)*20
  var height =  Math.round((window.innerHeight-bottomHeight-15)/20)*20

  window.onresize = function(){
       leftwidth = (document.body.clientWidth/1366)*80;
       rightwidth =  (document.body.clientWidth/1366)*200;
       bottomHeight =  (document.body.clientWidth/1366)*150;
       width = Math.round((window.innerWidth-leftwidth-rightwidth-15)/20)*20
       height =  Math.round((window.innerHeight-bottomHeight-15)/20)*20

  }
  svgEditor.setConfig({
          serviceUrl:serviceUrl,//正式部署直接用window.parent.serverurl
          canvas_expansion: 1,
          dimensions: [width,height],
          allowInitialUserOverride: true,
          extensions: ['ext-overview_window','ext-server-opensave','ext-cube','ext-arc'],
          noDefaultExtensions: false,
          // userExtensions: [ { pathName: './react-extensions/react-test/dist/react-test.js' }]
        },{allowInitialUserOverride:true})
        // Variable XDOMAIN below is created by Rollup for the Xdomain build (see rollup.config.js)
/* globals XDOMAIN */
try { // try clause to avoid js to complain if XDOMAIN undefined
          if (XDOMAIN) {
            svgEditor.setConfig({
              canvasName: 'xdomain', // Namespace this
              allowedOrigins: [ '*' ]
            })
    console.info('xdomain config activated')
  }
        } catch (error) { /* empty fn */ }
      </script>
</html>
